package com.myqm.controller.admin;

import java.util.List;

import javax.validation.Valid;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.github.pagehelper.PageInfo;
import com.myqm.dto.ResultResponse;
import com.myqm.pojo.weixin.Customer;
import com.myqm.pojo.weixin.query.QueryCustomer;
import com.myqm.service.weixin.CustomerService;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
@Api(tags = "高水原系统客户信息")
@RestController
@RequestMapping(value="/admin/customer")
public class CustomerController {

	@Autowired
	public CustomerService logisticsCustomerService;
	 
	@ApiOperation(value = "根据ID查询记录") 
	@PutMapping(value = "/get")
	public ResultResponse<Customer> getById(
			@ApiParam(required = true, value = "查询记录编号")
			@RequestBody @Valid Integer id) {
		return new ResultResponse<Customer>(logisticsCustomerService.getById(id));
	}

	 
	@ApiOperation(value = "详细列表查询") 
	@PostMapping(value = "/list")
	public ResultResponse<PageInfo<Customer>>  list
	( @ApiParam(required = false, value = "查询参数")
	@Valid @RequestBody QueryCustomer param) {
	 return new ResultResponse<PageInfo<Customer>>
			 (logisticsCustomerService.list(param.getPageNum(), param.getPageSize(),
					 param));
	} 
}
